<template>
  <div class="container">
    <el-row type="flex" justify="space-between">
      <!-- 订单表单 -->
      <div class="main">
        <OrderForm
          v-if="flights.id"
          :flightsData="flights"
          @sentFlightAmount="sentFlightAmount"
        />
      </div>

      <!-- 侧边栏 -->
      <div class="aside">
        <OrderAside :flightAmount="flightAmount" :data="flights" />
      </div>
    </el-row>
  </div>
</template>

<script>
import OrderAside from "@/components/air/OrderAside";
import OrderForm from "@/components/air/OrderForm";
// import Odtest from "@/components/air/Odtest";

export default {
  data() {
    return {
      flights: {},
      flightAmount: 0,
    };
  },
  components: {
    OrderAside,
    OrderForm,
    // Odtest,
  },
  created() {
    //发送请求 根据id获取机票数据
    this.$axios({
      url: "/airs/" + this.$route.query.id,
      params: {
        seat_xid: this.$route.query.seat_xid,
      },
    }).then((res) => {
      console.log("获取机票");
      console.log(res);
      this.flights = res.data;
      console.log(this.flights, "this.flights");
    });
  },
  methods: {
    sentFlightAmount(price) {
      // console.log(price);
      // 存储到本地的data
      this.flightAmount = price;
    },
  },
  computed: {
    // 计算飞行时间
    flightsTime() {},
  },
};
</script>

<style lang="less" scoped>
.container {
  width: 1000px;
  margin: 20px auto;
}

/*aside*/
.aside {
  width: 350px;
  height: fit-content;
  border: 1px #ddd solid;
}
</style>